package system

import "gorm.io/gorm"

type Role struct {
	gorm.Model
	Name           string  `gorm:"type:varchar(20);not null;unique" json:"name"`
	Remark         *string `gorm:"type:varchar(100);" json:"remark"`
	Status         uint    `gorm:"type:tinyint(1);default:1;comment:'1正常, 2禁用, 3全部'" json:"status"`
	Code           string  `gorm:"type:varchar(100);" json:"code"`
	Sort           uint    `gorm:"type:int(3);default:999;comment:'角色排序'" json:"sort"`
	Creator        string  `gorm:"type:varchar(20);" json:"creator"`
	Updater        string  `gorm:"type:varchar(20);" json:"updater"`
	DataScope      *int    `gorm:"type:int(16);" json:"dataScope"`
	DataScopeDepts []*Dept `gorm:"many2many:role_depts;" json:"dataScopeDepts"`
	Users          []*User `gorm:"many2many:user_roles" json:"users"`
	Menus          []*Menu `gorm:"many2many:role_menus;" json:"menus"` // 角色菜单多对多关系
}
